package com.fusetech.flow.audit.util;


import com.fusetech.common.core.domain.entity.SysRole;
import com.fusetech.common.core.domain.entity.SysUser;
import com.fusetech.flow.audit.model.Audit;
import com.fusetech.flow.audit.service.dto.CurrentAuditNodeDTO;

import java.util.List;

/**
 * 审核工具
 *
 * @author Liuwq
 * @Author：Liuwq-Fuse
 * @Package：com.zxhy.service.erp.audit.util
 * @Project：zhixing-heyue-erp-server-dev
 * @name：AuditUtil
 * @Date：2023/6/7 10:35
 * @Filename：AuditUtil
 * @date 2023/06/07
 */
public class AuditUtil {
    /**
     * 建立审计参数
     *
     * @param sysUser             系统用户
     * @param status              状态
     * @param idea                想法
     * @param currentRole         系统用户权限
     * @param currentAuditNodeDTO 当前审计节点dto
     * @return {@link Audit}
     */
    public static Audit buildAuditParam(CurrentAuditNodeDTO currentAuditNodeDTO, SysUser sysUser, String status, String idea, List<SysRole> currentRole){
        Audit audit = new Audit();
        audit.setDocumentId(currentAuditNodeDTO.getDocumentId());
        audit.setAuditor(sysUser);
        audit.setStatus(status);
        audit.setDocumentName(currentAuditNodeDTO.getDocument());
        audit.setDocumentType(currentAuditNodeDTO.getDocumentType());
        audit.setListSysRole(currentRole);
        audit.setCurrentNodeId(currentAuditNodeDTO.getNodeId());
        audit.setComments(idea);
        return audit;
    }
}
